﻿using DLL.NET60.DB.MS.Entity.DTO;
using DLL.NetStandard.FlushRobot.MS.Entity.Param;

using Prism.Services.Dialogs;
using System;
using System.Windows;

namespace DLL.FlushRobot.MS.Run
{
    public class COneRowStation : ICloneable
    {
        //public COneRowStation(CMS_DeviceConfigParam deviceConfig)
        //{
        //    DeviceConfig = deviceConfig;
        //}
        [Unity.Dependency]
        public IDialogService _dialogService { get; set; }

        private static int MaxColPointCount = 8;
        public int ValidRowCount = 0;
        public int RowID = 0;
        public double XPos = 0;//每个站X轴位置信息
        public double actualFlushAir = 0;
        public double InjectHadVolume = 0;//注射器内有的溶媒量
        public int StationColNum = 6;
        public CMS_DeviceConfigParam DeviceConfig = new CMS_DeviceConfigParam();//设备参数
        public DTO_adi_dic_drug UsedDrug = new DTO_adi_dic_drug();
        public DTO_adi_dic_drug UsedSolvent = new DTO_adi_dic_drug();
        public CSingleStation[] RowStations = new CSingleStation[MaxColPointCount];

        public COneRowStation()
        {
            UsedDrug.InitializeFlushGroup();
            UsedDrug.InitializeFlushParam();
            UsedSolvent.InitializeFlushGroup();
            UsedSolvent.InitializeFlushParam();
        }

        public object Clone()
        {
            COneRowStation oneRow = new COneRowStation();
            oneRow.ValidRowCount = this.ValidRowCount;
            oneRow.RowID = this.RowID;
            oneRow.XPos = this.XPos;
            oneRow.StationColNum = StationColNum;
            oneRow.actualFlushAir = this.actualFlushAir;
            oneRow.InjectHadVolume = this.InjectHadVolume;
            oneRow.DeviceConfig = this.DeviceConfig;
            oneRow.UsedDrug = (DTO_adi_dic_drug)this.UsedDrug.Clone();
            oneRow.UsedSolvent = (DTO_adi_dic_drug)this.UsedSolvent.Clone();
            for (int i = 0; i < MaxColPointCount; i++)
            {
                oneRow.RowStations[i] = (CSingleStation)this.RowStations[i].Clone();
            }

            return oneRow;
        }

        #region base function

        public double GetMaxValue(double[] all)
        {
            int count = all.Length;
            double a = 0;
            for (int i = 0; i < count; i++)
            {
                if (all[i] > a)
                {
                    a = all[i];
                }
            }
            return a;
        }

        public int GetMaxValue(int[] all)
        {
            int count = all.Length;
            int a = 0;
            for (int i = 0; i < count; i++)
            {
                if (all[i] > a)
                {
                    a = all[i];
                }
            }
            return a;
        }

        public double GetMinValue(double[] all)
        {
            int count = all.Length;
            double a = all[0];
            for (int i = 0; i < count; i++)
            {
                if (all[i] < a)
                {
                    a = all[i];
                }
            }
            return a;
        }

        public int GetMinValue(int[] all)
        {
            int count = all.Length;
            int a = all[0];
            for (int i = 0; i < count; i++)
            {
                if (all[i] < a)
                {
                    a = all[i];
                }
            }
            return a;
        }

        #endregion base function

        public bool HaveDrug()
        {
            for (int i = 0; i < StationColNum; i++)
            {
                if (1 == RowStations[i].UsedFlag)
                {
                    return true;
                }
            }
            return false;
        }

        public bool HaveDrug(int[] iValidCol)
        {
            for (int col = 0; col < iValidCol.Length; col++)
            {
                if ((1 == iValidCol[col]) && (1 == RowStations[col].UsedFlag))
                {
                    return true;
                }
            }
            return false;
        }

        public int[] GetUsedFlag()
        {
            int[] usedFlag = new int[MaxColPointCount];
            for (int i = 0; i < StationColNum; i++)
            {
                usedFlag[i] = RowStations[i].UsedFlag;
            }
            return usedFlag;
        }

        public int[] ANDFlag(int[] validStation)
        {
            int[] usedFlag = new int[MaxColPointCount];
            for (int i = 0; i < StationColNum; i++)
            {
                if ((RowStations[i].UsedFlag == 1) && (validStation[i] == 1))
                {
                    usedFlag[i] = 1;
                }
                else
                {
                    usedFlag[i] = 0;
                }
            }
            return usedFlag;
        }

        //获取最后抽液标志位
        public int[] GetPullOutFlag(int[] ivalidCol)
        {
            int[] usedFlag = new int[MaxColPointCount];
            for (int i = 0; i < StationColNum; i++)
            {
                if ((RowStations[i].UsedFlag == 1) && (ivalidCol[i] == 1) && (RowStations[i].FeiZhengZhiMode == 0))
                {
                    usedFlag[i] = 1;
                }
                else
                {
                    usedFlag[i] = 0;
                }
            }
            return usedFlag;
        }

        //获取反复抽液标志位
        public int[] GetRepetiveFlag(int[] ivalidCol)
        {
            int[] usedFlag = new int[MaxColPointCount];
            for (int i = 0; i < StationColNum; i++)
            {
                if ((RowStations[i].UsedFlag == 1) && (ivalidCol[i] == 1) && (RowStations[i].FeiZhengZhiMode == 0))
                {
                    usedFlag[i] = 1;
                }
                else
                {
                    usedFlag[i] = 0;
                }
            }
            return usedFlag;
        }

        public int[] GetFlushInAireFlag(int[] usedFlag, int dmLoopIndex)
        {
            int[] validFlag = new int[MaxColPointCount];
            double[] flushInAire = GetFLUSH_AIRE(dmLoopIndex);
            int[] pressure = GetPOSITIVE_PRESSURE();
            for (int i = 0; i < StationColNum; i++)
            {
                if (usedFlag[i] == 1)
                {
                    if (RowStations[i].FeiZhengZhiMode == 1)
                    {
                        //非整只，不能注入空气
                        validFlag[i] = 0;
                    }
                    else
                    {
                        if ((pressure[i] > 3) && (flushInAire[i] > 0))
                        {
                            validFlag[i] = usedFlag[i];
                        }
                        else
                        {
                            validFlag[i] = 0;
                        }
                    }
                }
                else
                {
                    validFlag[i] = 0;
                }
            }
            return validFlag;
        }

        public int[] GetPumpbackValidCol(int[] inValidCol)
        {
            int[] usedFlag = new int[MaxColPointCount];
            for (int i = 0; i < StationColNum; i++)
            {
                if ((RowStations[i].UsedFlag == 1) && (inValidCol[i] == 1) && (RowStations[i].FeiZhengZhiMode == 0))
                {
                    usedFlag[i] = 1;
                }
                else
                {
                    usedFlag[i] = 0;
                }
            }
            return usedFlag;
        }

        public int[] GetFZZFlag()
        {
            int[] FZZFlag = new int[MaxColPointCount];
            for (int i = 0; i < StationColNum; i++)
            {
                if (RowStations[i].UsedFlag == 1)
                {
                    FZZFlag[i] = RowStations[i].FeiZhengZhiMode;
                }
                else
                {
                    FZZFlag[i] = 0;
                }
            }
            return FZZFlag;
        }

        public int[] GetFZZBackToBottleFlag(int[] validCol, int dmLoopIndex)
        {
            int[] values = new int[MaxColPointCount];
            for (int col = 0; col < StationColNum; col++)
            {
                if ((validCol[col] == 1))
                {
                    if ((RowStations[col].FeiZhengZhiMode == 1) && (dmLoopIndex == 0))
                    {
                        //非整只
                        values[col] = 1;
                    }
                    else
                    {
                        //整只模式
                        values[col] = 0;
                    }
                }
            }
            return values;
        }

        //获取多抽标志位
        public int[] GetPullOutAddtionalFlag(int[] validStation)
        {
            int[] validCol = new int[MaxColPointCount];
            for (int i = 0; i < StationColNum; i++)
            {
                if ((RowStations[i].UsedFlag == 1) && (validStation[i] == 1))
                {
                    if (RowStations[i].FeiZhengZhiMode == 1)
                    {
                        //非整只不支持多抽
                        validCol[i] = 0;
                    }
                    else
                    {
                        validCol[i] = 1;
                    }
                }
                else
                {
                    validCol[i] = 0;
                }
            }
            return validCol;
        }

        #region 根据属性，获取启用的站

        //获取正压标志位
        public int[] GetOrgPositivePressureFlag()
        {
            //获取原始压强
            int[] org = new int[MaxColPointCount];
            for (int col = 0; col < StationColNum; col++)
            {
                if (RowStations[col].UsedFlag == 1)
                {
                    org[col] = RowStations[col].UsedDrug.ORIGINAL_PRESSURE;
                    if (RowStations[col].UsedDrug.ORIGINAL_PRESSURE == 0)//0:正压，1：常压2：负压
                    {
                        org[col] = 1;
                    }
                    else
                    {
                        org[col] = 0;
                    }
                }
                else
                {
                    org[col] = 0;
                }
            }
            return org;
        }

        //获取负压标志位
        public int[] GetOrgNegativePressureFlag()
        {
            //获取原始压强
            int[] org = new int[MaxColPointCount];
            for (int col = 0; col < StationColNum; col++)
            {
                if (RowStations[col].UsedFlag == 1)
                {
                    org[col] = RowStations[col].UsedDrug.ORIGINAL_PRESSURE;
                    if (RowStations[col].UsedDrug.ORIGINAL_PRESSURE == 2)//0:正压，1：常压2：负压
                    {
                        org[col] = 1;
                    }
                    else
                    {
                        org[col] = 0;
                    }
                }
                else
                {
                    org[col] = 0;
                }
            }
            return org;
        }

        public int[] GetValidDrugCount()
        {
            int[] values = new int[MaxColPointCount];
            for (int col = 0; col < StationColNum; col++)
            {
                if (RowStations[col].UsedFlag == 1)
                {
                    values[col] = RowStations[col].ValidDrugCount;
                }
                else
                {
                    values[col] = 0;
                }
            }
            return values;
        }

        #endregion 根据属性，获取启用的站

        private int GetUsedStationCount()
        {
            int count = 0;
            for (int i = 0; i < StationColNum; i++)
            {
                if (RowStations[i].UsedFlag == 1)
                {
                    count++;
                }
            }
            return count;
        }

        public double[] GetFlushSolventVolume(int dmLoopIndex)
        {
            double[] values = new double[MaxColPointCount];
            for (int i = 0; i < StationColNum; i++)
            {
                if (RowStations[i].UsedFlag == 1)
                {
                    int FlushGroupIndex = RowStations[i].UsedDrug.FlushGroupIndex;
                    values[i] = RowStations[i].UsedDrug.flush_Groups[FlushGroupIndex].flush_Params[dmLoopIndex].SolventVolume;
                }
                else
                {
                    values[i] = 0;
                }
            }
            return values;
        }

        public double[] GetFlushOutSolventVolume(int[] fzzFlag, int dmLoopIndex)
        {
            double[] OutMl = new double[MaxColPointCount];
            double[] InVolume = GetFlushInVolume(dmLoopIndex);
            double[] SolventVolume = GetFlushSolventVolume(dmLoopIndex);
            for (int col = 0; col < StationColNum; col++)
            {
                int FlushGroupIndex = RowStations[col].UsedDrug.FlushGroupIndex;
                if (RowStations[col].UsedFlag == 0)
                {
                    OutMl[col] = 0;
                    continue;
                }
                if (dmLoopIndex == 0)
                {
                    if (UsedDrug.SOLVENT_FLAG == 0)
                    {
                        //普通溶媒
                        if ((fzzFlag[col] == 1))
                        {
                            //非整只模式:水针是计算出来的实际体积，专用溶媒，抽出的是冲刷体积
                            OutMl[col] = InVolume[col];
                        }
                        else
                        {
                            //整只抽取的溶媒
                            OutMl[col] = SolventVolume[col];
                        }
                    }
                    else if (UsedDrug.SOLVENT_FLAG == 2)
                    {
                        //专用溶媒:不管是不是整只，都要将专用溶媒全部抽完
                        OutMl[col] = InVolume[col];
                    }
                    else
                    {
                        //MessageBox.Show("溶媒属性设置有问题，无法进行配药，请确定药品属性！");
                        string str = "溶媒属性设置有问题，无法进行配药，请确定药品属性";
                        Application.Current.Dispatcher.Invoke(
                        (Action)delegate ()
                        {
                            _dialogService.ShowDialog("WarningDialog", new DialogParameters($"message={str}"), null);
                        });
                        OutMl[col] = 0;
                    }
                }
                else
                {
                    if (fzzFlag[col] == 1)
                    {
                        //非整只模式，抽取的溶媒
                        OutMl[col] = 0;
                    }
                    else
                    {
                        //整只抽取的溶媒
                        OutMl[col] = SolventVolume[col];
                    }
                }
            }
            return OutMl;
        }

        public double[] GetFlushOutSolventVolume(int[] fzzFlag, int[] validCol, int dmLoopIndex)
        {
            double[] OutMl = new double[MaxColPointCount];
            double[] fzzInVolume = GetFzzInVolume();
            double[] bottleVolume = GetBottleVolume();
            double[] SolventVolume = GetFlushSolventVolume(dmLoopIndex);
            for (int col = 0; col < StationColNum; col++)
            {
                int FlushGroupIndex = RowStations[col].UsedDrug.FlushGroupIndex;
                if ((RowStations[col].UsedFlag == 0) || (validCol[col] == 0))
                {
                    OutMl[col] = 0;
                    continue;
                }
                if (dmLoopIndex == 0)
                {
                    if (UsedDrug.SOLVENT_FLAG == 0)
                    {
                        //非溶媒
                        if ((fzzFlag[col] == 1))
                        {
                            //非整只模式:粉针
                            OutMl[col] = fzzInVolume[col];
                        }
                        else
                        {
                            //整只抽取的溶媒
                            OutMl[col] = SolventVolume[col];
                        }
                    }
                    else if (UsedDrug.SOLVENT_FLAG == 2)
                    {
                        //专用溶媒:不管是不是整只，都要将专用溶媒全部抽完
                        OutMl[col] = bottleVolume[col];
                    }
                    else
                    {
                        //MessageBox.Show("溶媒属性设置有问题，无法进行配药，请确定药品属性！");
                        string str = "溶媒属性设置有问题，无法进行配药，请确定药品属性！";
                        Application.Current.Dispatcher.Invoke(
                        (Action)delegate ()
                        {
                            _dialogService.ShowDialog("WarningDialog", new DialogParameters($"message={str}"), null);
                        });
                        OutMl[col] = 0;
                    }
                }
                else
                {
                    if (fzzFlag[col] == 1)
                    {
                        //非整只模式，抽取的溶媒
                        OutMl[col] = 0;
                    }
                    else
                    {
                        //整只抽取的溶媒
                        OutMl[col] = SolventVolume[col];
                    }
                }
            }
            return OutMl;
        }

        #region drug propery

        public int[] GetOutSolventSpeed()
        {
            int[] dspeed = new int[MaxColPointCount];
            for (int i = 0; i < StationColNum; i++)
            {
                int percent = RowStations[i].UsedDrug.OutSolventSpeed;
                dspeed[i] = percent;
            }
            return dspeed;
        }

        //InjcetBackDistance
        public double[] GetInjcetBackDistance()
        {
            double[] values = new double[MaxColPointCount];
            for (int i = 0; i < StationColNum; i++)
            {
                double value = 0;
                if (RowStations[i].UsedFlag == 1)
                {
                    value = RowStations[i].UsedDrug.InjcetBackDistance;
                }
                else
                {
                    value = 0;
                }
                values[i] = value;
            }
            return values;
        }

        //FlushLoopCount
        public int[] GetDispenseMedicineLoopCount()
        {
            int[] values = new int[MaxColPointCount];
            for (int i = 0; i < StationColNum; i++)
            {
                int FlushGroupIndex = RowStations[i].UsedDrug.FlushGroupIndex;
                int value = 0;
                if (RowStations[i].UsedFlag == 1)
                {
                    value = RowStations[i].UsedDrug.flush_Groups[FlushGroupIndex].FlushLoopCount + 1;
                }
                else
                {
                    value = 0;
                }
                values[i] = value;
            }
            return values;
        }

        //OrgPullOutAire
        public double[] GetOrgPullOutAire()
        {
            double[] values = new double[MaxColPointCount];
            for (int col = 0; col < StationColNum; col++)
            {
                double value = 0;
                if (RowStations[col].UsedFlag == 1)
                {
                    value = RowStations[col].UsedDrug.OrgPullOutAire;
                    if (RowStations[col].UsedDrug.ORIGINAL_PRESSURE == 0)
                    {
                        //正压
                        if (value > 5)
                        {
                            value = 5;
                        }
                        else if (value < 0)
                        {
                            value = 0;
                        }
                    }
                    else
                    {
                        if (value > 20)
                        {
                            value = 20;
                        }
                        else if (value < 0)
                        {
                            value = 0;
                        }
                    }
                    //负压可以注入任意多的空气
                }
                else
                {
                    value = 0;
                }
                values[col] = value;
            }
            return values;
        }

        //BOTTLE_THICKNESS
        public double[] GetBOTTLE_THICKNESS()
        {
            double[] values = new double[MaxColPointCount];
            for (int col = 0; col < StationColNum; col++)
            {
                double value = 0;
                if (RowStations[col].UsedFlag == 1)
                {
                    value = RowStations[col].UsedDrug.BOTTLE_THICKNESS;
                }
                else
                {
                    value = 0;
                }
                values[col] = value;
            }
            return values;
        }
        
        //DropCrumb
        public int[] GetDropCrumb()
        {
            int[] values = new int[MaxColPointCount];
            for (int col = 0; col < StationColNum; col++)
            {
                int value = 0;
                if (RowStations[col].UsedFlag == 1)
                {
                    value = RowStations[col].UsedDrug.DropCrumb;
                }
                else
                {
                    value = 0;
                }
                values[col] = value;
            }
            return values;
        }

        //PunctureSlowSpeed
        public int[] GetPunctureSlowSpeed()
        {
            int[] values = new int[MaxColPointCount];
            for (int col = 0; col < StationColNum; col++)
            {
                int value = 0;
                if (RowStations[col].UsedFlag == 1)
                {
                    value = RowStations[col].UsedDrug.PunctureSlowSpeed;
                }
                else
                {
                    value = 0;
                }
                values[col] = value;
            }
            return values;
        }

        //POSITIVE_PRESSURE
        public int[] GetPOSITIVE_PRESSURE()
        {
            int[] values = new int[MaxColPointCount];
            for (int col = 0; col < StationColNum; col++)
            {
                int value = 0;
                if (RowStations[col].UsedFlag == 1)
                {
                    value = RowStations[col].UsedDrug.POSITIVE_PRESSURE;
                }
                else
                {
                    value = -1;
                }
                values[col] = value;
            }
            return values;
        }

        public double[] GetBOTTLE_VOLUME()
        {
            double[] values = new double[MaxColPointCount];
            for (int col = 0; col < StationColNum; col++)
            {
                double value = 0;
                if (RowStations[col].UsedFlag == 1)
                {
                    value = RowStations[col].UsedDrug.BOTTLE_VOLUME;
                }
                else
                {
                    value = 0;
                }
                values[col] = value;
            }
            return values;
        }

        #endregion drug propery

        #region flush param

        //InjectorRinseCount
        public int[] GetFlushInjectorRinseCount(int dmLoopIndex)
        {
            int[] values = new int[MaxColPointCount];
            for (int col = 0; col < StationColNum; col++)
            {
                int FlushGroupIndex = RowStations[col].UsedDrug.FlushGroupIndex;
                int value = 0;
                if (RowStations[col].UsedFlag == 1)
                {
                    value = RowStations[col].UsedDrug.flush_Groups[FlushGroupIndex].flush_Params[dmLoopIndex].InjectorRinseCount;
                }
                else
                {
                    value = 0;
                }
                values[col] = value;
            }
            return values;
        }

        //FlushSolventPushBackSpeed
        public int[] GetFlushSolventPushBackSpeed(int dmLoopIndex)
        {
            int[] values = new int[MaxColPointCount];
            for (int col = 0; col < StationColNum; col++)
            {
                int FlushGroupIndex = RowStations[col].UsedDrug.FlushGroupIndex;
                int value = RowStations[col].UsedDrug.flush_Groups[FlushGroupIndex].flush_Params[dmLoopIndex].FlushSolventPushBackSpeed;
                values[col] = value;
            }
            return values;
        }

        //PumpBackSolventPushBackSpeed
        public int[] GetFlushPumpBackSolventPushBackSpeed(int dmLoopIndex)
        {
            int[] values = new int[MaxColPointCount];
            for (int i = 0; i < StationColNum; i++)
            {
                int FlushGroupIndex = RowStations[i].UsedDrug.FlushGroupIndex;
                int value = RowStations[i].UsedDrug.flush_Groups[FlushGroupIndex].pumpBack_Params[dmLoopIndex].PumpBackSolventPushBackSpeed;
                values[i] = value;
            }
            return values;
        }

        #region 冲刷参数

        public double[] GetFlushInVolume(int dmLoopIndex)
        {
            double[] flushInVolume = new double[MaxColPointCount];
            for (int i = 0; i < StationColNum; i++)
            {
                if (RowStations[i].UsedFlag == 1)
                {
                    int FlushGroupIndex = RowStations[i].UsedDrug.FlushGroupIndex;
                    if (RowStations[i].FeiZhengZhiMode == 1)
                    {
                        flushInVolume[i] = RowStations[i].UsedDrug.flush_Groups[FlushGroupIndex].flush_Params[dmLoopIndex].fzzFlushInVolume;
                    }
                    else
                    {
                        flushInVolume[i] = RowStations[i].UsedDrug.flush_Groups[FlushGroupIndex].flush_Params[dmLoopIndex].IN_VOLUME;
                    }
                }
                else
                {
                    flushInVolume[i] = 0;
                }
            }
            return flushInVolume;
        }

        public double[] GetFzzOutVolume()
        {
            double[] flushInVolume = new double[MaxColPointCount];
            for (int i = 0; i < StationColNum; i++)
            {
                if (RowStations[i].UsedFlag == 1)
                {
                    flushInVolume[i] = RowStations[i].fzz_OutVolume;
                }
                else
                {
                    flushInVolume[i] = 0;
                }
            }
            return flushInVolume;
        }

        public double[] GetFzzInVolume()
        {
            double[] flushInVolume = new double[MaxColPointCount];
            for (int i = 0; i < StationColNum; i++)
            {
                if (RowStations[i].UsedFlag == 1)
                {
                    int FlushGroupIndex = RowStations[i].UsedDrug.FlushGroupIndex;
                    flushInVolume[i] = RowStations[i].UsedDrug.flush_Groups[FlushGroupIndex].flush_Params[0].fzzFlushInVolume;
                }
                else
                {
                    flushInVolume[i] = 0;
                }
            }
            return flushInVolume;
        }

        public double[] GetBottleVolume()
        {
            double[] flushInVolume = new double[MaxColPointCount];
            for (int i = 0; i < StationColNum; i++)
            {
                if (RowStations[i].UsedFlag == 1)
                {
                    flushInVolume[i] = RowStations[i].UsedDrug.BOTTLE_VOLUME;
                }
                else
                {
                    flushInVolume[i] = 0;
                }
            }
            return flushInVolume;
        }

        public double[] GetFlushOutVolume(int dmLoopIndex)
        {
            double[] flushInVolume = new double[MaxColPointCount];
            for (int i = 0; i < StationColNum; i++)
            {
                if (RowStations[i].UsedFlag == 1)
                {
                    int FlushGroupIndex = RowStations[i].UsedDrug.FlushGroupIndex;
                    if (RowStations[i].FeiZhengZhiMode == 1)
                    {
                        flushInVolume[i] = RowStations[i].UsedDrug.flush_Groups[FlushGroupIndex].flush_Params[dmLoopIndex].fzzFlushOutVolume;
                    }
                    else
                    {
                        flushInVolume[i] = RowStations[i].UsedDrug.flush_Groups[FlushGroupIndex].flush_Params[dmLoopIndex].FlushOutVolume;
                    }
                }
                else
                {
                    flushInVolume[i] = 0;
                }
            }
            return flushInVolume;
        }

        public int[] GetFlushOutSpeed(int dmLoopIndex)
        {
            int[] values = new int[MaxColPointCount];
            for (int i = 0; i < StationColNum; i++)
            {
                int FlushGroupIndex = RowStations[i].UsedDrug.FlushGroupIndex;
                int value = (int)UsedDrug.flush_Groups[FlushGroupIndex].flush_Params[dmLoopIndex].FlushOutSpeed;
                values[i] = value;
            }
            return values;
        }
        public double[] Get_FlushOutHeightOffset(int dmLoopIndex)
        {
       
            double[] values = new double[MaxColPointCount];
            for (int col = 0; col < 6; col++)
            {
                if (RowStations[col].UsedFlag == 1)
                {
                    int FlushGroupIndex = RowStations[col].UsedDrug.FlushGroupIndex;
                    values[col] = RowStations[col].UsedDrug.flush_Groups[FlushGroupIndex].flush_Params[dmLoopIndex].FlushOutHeightOffset;
                }
                else
                {
                    values[col] = 0;
                }
            }
            return values;
        }
        public int[] GetFlushOutSlowSpeed(int dmLoopIndex)
        {
            int[] values = new int[MaxColPointCount];
            for (int i = 0; i < StationColNum; i++)
            {
                int FlushGroupIndex = RowStations[i].UsedDrug.FlushGroupIndex;
                int value = RowStations[i].UsedDrug.flush_Groups[FlushGroupIndex].flush_Params[dmLoopIndex].FlushOutSlowSpeed;
                values[i] = value;
            }
            return values;
        }

        public int[] GetFlushInSpeed(int dmLoopIndex)
        {
            int[] values = new int[MaxColPointCount];
            for (int i = 0; i < StationColNum; i++)
            {
                int FlushGroupIndex = RowStations[i].UsedDrug.FlushGroupIndex;
                int value = (int)RowStations[i].UsedDrug.flush_Groups[FlushGroupIndex].flush_Params[dmLoopIndex].FlushInSpeed;
                values[i] = value;
            }
            return values;
        }

        //FlushMethod
        public int[] GetFlushMethod(int dmLoopIndex)
        {
            int[] values = new int[MaxColPointCount];
            for (int col = 0; col < StationColNum; col++)
            {
                int FlushGroupIndex = RowStations[col].UsedDrug.FlushGroupIndex;
                int loopCount = RowStations[col].UsedDrug.flush_Groups[FlushGroupIndex].FlushLoopCount + 1;//获取配药循环次数
                int value = RowStations[col].UsedDrug.flush_Groups[FlushGroupIndex].flush_Params[dmLoopIndex].FlushMethod;
                if ((RowStations[col].UsedFlag == 1) && (dmLoopIndex < loopCount))
                {
                    value = RowStations[col].UsedDrug.flush_Groups[FlushGroupIndex].flush_Params[dmLoopIndex].FlushMethod;
                }
                else
                {
                    value = 0;
                }
                values[col] = value;
            }
            return values;
        }

        public int[] GetFlushMethodFlag(int dmLoopIndex, int defineValue, int[] validCol)
        {
            int[] values = new int[MaxColPointCount];
            for (int col = 0; col < StationColNum; col++)
            {
                int FlushGroupIndex = RowStations[col].UsedDrug.FlushGroupIndex;
                int loopCount = RowStations[col].UsedDrug.flush_Groups[FlushGroupIndex].FlushLoopCount + 1;//获取配药循环次数
                int value = RowStations[col].UsedDrug.flush_Groups[FlushGroupIndex].flush_Params[dmLoopIndex].FlushMethod;//获取第几次循环的冲刷方式
                if (value == defineValue)
                {
                    if ((RowStations[col].UsedFlag == 1) && (dmLoopIndex < loopCount) && (validCol[col] == 1))
                    {
                        values[col] = 1;
                    }
                    else
                    {
                        values[col] = 0;
                    }
                }
                else
                {
                    values[col] = 0;
                }
            }
            return values;
        }

        public int[] GetFlushCount(int row, int dmLoopIndex, int[] validCol)
        {
            int[] values = new int[MaxColPointCount];
            for (int col = 0; col < StationColNum; col++)
            {
                int FlushCount = 0;
                if (validCol[col] == 1)
                {
                    int FlushGroupIndex = RowStations[col].UsedDrug.FlushGroupIndex;

                    switch (row)
                    {
                        case 1:
                            FlushCount = Convert.ToInt32(RowStations[col].UsedDrug.flush_Groups[FlushGroupIndex].flush_Params[dmLoopIndex].FLUSH_COST1);
                            break;

                        case 2:
                            FlushCount = Convert.ToInt32(RowStations[col].UsedDrug.flush_Groups[FlushGroupIndex].flush_Params[dmLoopIndex].FLUSH_COST2);
                            break;

                        case 3:
                            FlushCount = Convert.ToInt32(RowStations[col].UsedDrug.flush_Groups[FlushGroupIndex].flush_Params[dmLoopIndex].FLUSH_COST3);
                            break;

                        case 4:
                            FlushCount = Convert.ToInt32(RowStations[col].UsedDrug.flush_Groups[FlushGroupIndex].flush_Params[dmLoopIndex].FLUSH_COST4);
                            break;

                        default:
                            FlushCount = Convert.ToInt32(RowStations[col].UsedDrug.flush_Groups[FlushGroupIndex].flush_Params[dmLoopIndex].FLUSH_COST1);
                            break;
                    }
                }

                if ((RowStations[col].UsedFlag == 1) && (validCol[col] == 1))
                {
                    values[col] = FlushCount;
                }
                else
                {
                    values[col] = 0;
                }
            }

            return values;
        }

        //FlushOffsetHeight
        public double[] GetFlushOffsetHeight(int dmLoopIndex)
        {
            double[] values = new double[MaxColPointCount];
            for (int col = 0; col < 6; col++)
            {
                if (RowStations[col].UsedFlag == 1)
                {
                    int FlushGroupIndex = RowStations[col].UsedDrug.FlushGroupIndex;
                    values[col] = RowStations[col].UsedDrug.flush_Groups[FlushGroupIndex].flush_Params[dmLoopIndex].FlushOffsetHeight;
                }
                else
                {
                    values[col] = 0;
                }
            }
            return values;
        }

        //FlushOutWait
        public double[] GetFlushOutWait(int dmLoopIndex)
        {
            double[] values = new double[MaxColPointCount];
            for (int col = 0; col < StationColNum; col++)
            {
                if (RowStations[col].UsedFlag == 1)
                {
                    int FlushGroupIndex = RowStations[col].UsedDrug.FlushGroupIndex;
                    values[col] = RowStations[col].UsedDrug.flush_Groups[FlushGroupIndex].flush_Params[dmLoopIndex].FlushOutWait;
                }
                else
                {
                    values[col] = 0;
                }
            }
            return values;
        }

        public double[] GetFlushOutLastWait(int dmLoopIndex)
        {
            double[] values = new double[MaxColPointCount];
            for (int col = 0; col < StationColNum; col++)
            {
                if (RowStations[col].UsedFlag == 1)
                {
                    int FlushGroupIndex = RowStations[col].UsedDrug.FlushGroupIndex;
                    values[col] = RowStations[col].UsedDrug.flush_Groups[FlushGroupIndex].flush_Params[dmLoopIndex].FlushOutLastWait;
                }
                else
                {
                    values[col] = 0;
                }
            }
            return values;
        }

        public int GetMaxFlushOutWait(int dmLoopIndex)
        {
            double[] time = GetFlushOutWait(dmLoopIndex);
            double maxTime = GetMaxValue(time);
            int waitTime = (int)(maxTime * 1000);
            return waitTime;
        }

        public int GetMaxFlushOutLastWait(int dmLoopIndex)
        {
            double[] time = GetFlushOutLastWait(dmLoopIndex);
            double maxTime = GetMaxValue(time);
            int waitTime = (int)(maxTime * 1000);
            return waitTime;
        }

        //PUMPING_WAIT
        public double[] GetPUMPING_WAIT(int dmLoopIndex)
        {
            double[] values = new double[MaxColPointCount];
            for (int col = 0; col < StationColNum; col++)
            {
                if (RowStations[col].UsedFlag == 1)
                {
                    int FlushGroupIndex = RowStations[col].UsedDrug.FlushGroupIndex;
                    values[col] = RowStations[col].UsedDrug.flush_Groups[FlushGroupIndex].flush_Params[dmLoopIndex].PUMPING_WAIT;
                }
                else
                {
                    values[col] = 0;
                }
            }
            return values;
        }

        public int GetMaxPUMPING_WAIT(int dmLoopIndex)
        {
            double[] time = GetPUMPING_WAIT(dmLoopIndex);
            double maxTime = GetMaxValue(time);
            int waitTime = (int)(maxTime * 1000);
            return waitTime;
        }

        public int[] GetEnableRoateBottle(int dmLoopIndex)
        {
            int[] values = new int[MaxColPointCount];
            for (int i = 0; i < StationColNum; i++)
            {
                int FlushGroupIndex = RowStations[i].UsedDrug.FlushGroupIndex;
                int value = (int)RowStations[i].UsedDrug.flush_Groups[FlushGroupIndex].flush_Params[dmLoopIndex].EnableRoatBottle;
                values[i] = value;
            }
            return values;
        }

        public int GetEnableRoateBottleFlag(int dmLoopIndex)
        {
            int[] values = GetEnableRoateBottle(dmLoopIndex);
            return GetMaxValue(values);
        }

        #endregion 冲刷参数

        public double[] GetInjectorRinseVolume(int dmLoopIndex)
        {
            //UsedDrug.flush_Groups[oneRow.UsedDrug.FlushGroupIndex].flush_Params[dmLoopIndex].InjectorRinseVolume
            double[] values = new double[MaxColPointCount];
            for (int col = 0; col < StationColNum; col++)
            {
                int FlushGroupIndex = RowStations[col].UsedDrug.FlushGroupIndex;
                double value = RowStations[col].UsedDrug.flush_Groups[FlushGroupIndex].flush_Params[dmLoopIndex].InjectorRinseVolume;
                if (RowStations[col].UsedFlag == 1)
                {
                    values[col] = RowStations[col].UsedDrug.flush_Groups[FlushGroupIndex].flush_Params[dmLoopIndex].InjectorRinseVolume;
                }
                else
                {
                    values[col] = 0;
                }
                values[col] = value;
            }
            return values;
        }

        #region 起泡属性

        public int[] GetBubble()
        {
            int[] values = new int[MaxColPointCount];
            for (int col = 0; col < StationColNum; col++)
            {
                if (RowStations[col].UsedFlag == 1)
                {
                    values[col] = RowStations[col].UsedDrug.HAS_BUBBLE;
                }
                else
                {
                    values[col] = 0;
                }
            }
            return values;
        }

        public int[] GetBubbleFlag()
        {
            int[] values = new int[MaxColPointCount];
            int[] bubbleValue = GetBubble();
            for (int col = 0; col < StationColNum; col++)
            {
                if (bubbleValue[col] > 0)
                {
                    //有气泡
                    values[col] = 1;
                }
                else
                {
                    //无气泡
                    values[col] = 0;
                }
            }
            int[] usedFlag = ANDFlag(values);
            return usedFlag;
        }

        public int[] GetLowBubbleFlag()
        {
            int[] values = new int[MaxColPointCount];
            int[] bubbleValue = GetBubble();
            for (int col = 0; col < StationColNum; col++)
            {
                if (bubbleValue[col] == 1)
                {
                    //有气泡
                    values[col] = 1;
                }
                else
                {
                    //无气泡
                    values[col] = 0;
                }
            }
            int[] usedFlag = ANDFlag(values);
            return usedFlag;
        }

        public int[] GetBubbleFlushInSpeed(int dmLoopIndex)
        {
            int[] values = new int[MaxColPointCount];
            for (int col = 0; col < StationColNum; col++)
            {
                int FlushGroupIndex = RowStations[col].UsedDrug.FlushGroupIndex;
                int value = 0;
                if (RowStations[col].UsedDrug.HAS_BUBBLE > 1)
                {
                    value = (int)RowStations[col].UsedDrug.flush_Groups[FlushGroupIndex].flush_Params[dmLoopIndex].BubbleFlushInSpeed;
                }
                else
                {
                    value = (int)RowStations[col].UsedDrug.flush_Groups[FlushGroupIndex].flush_Params[dmLoopIndex].FlushInSpeed;
                }
                values[col] = value;
            }
            return values;
        }

        #endregion 起泡属性

        #region 粘稠属性

        //Viscosity,粘稠标志位
        public int[] GetViscosity()
        {
            int[] values = new int[MaxColPointCount];
            for (int col = 0; col < StationColNum; col++)
            {
                if (RowStations[col].UsedFlag == 1)
                {
                    values[col] = RowStations[col].UsedDrug.Viscosity;
                }
                else
                {
                    values[col] = 0;
                }
            }
            return values;
        }

        public int[] GetViscosityFlag()
        {
            int[] values = new int[MaxColPointCount];
            for (int col = 0; col < StationColNum; col++)
            {
                if (RowStations[col].UsedFlag == 1)
                {
                    if (RowStations[col].UsedDrug.Viscosity > 0)
                    {
                        values[col] = 1;
                    }
                    else
                    {
                        values[col] = 0;
                    }
                }
                else
                {
                    values[col] = 0;
                }
            }
            return values;
        }

        //ViscosityFlushInSpeed
        public int[] GetViscosityFlushInSpeed(int dmLoopIndex)
        {
            int[] values = new int[MaxColPointCount];
            for (int col = 0; col < StationColNum; col++)
            {
                int FlushGroupIndex = RowStations[col].UsedDrug.FlushGroupIndex;
                int percent = RowStations[col].UsedDrug.flush_Groups[FlushGroupIndex].flush_Params[dmLoopIndex].ViscosityFlushInSpeed;

                values[col] = percent;
            }
            return values;
        }

        public double[] GetViscosityInVolume(int dmLoopIndex)
        {
            double[] values = new double[MaxColPointCount];
            for (int i = 0; i < StationColNum; i++)
            {
                if ((RowStations[i].UsedFlag == 1) && (RowStations[i].UsedDrug.Viscosity > 0))
                {
                    int FlushGroupIndex = RowStations[i].UsedDrug.FlushGroupIndex;
                    double value = RowStations[i].UsedDrug.flush_Groups[FlushGroupIndex].flush_Params[dmLoopIndex].ViscosityInVolume;
                    values[i] = value;
                }
                else
                {
                    values[i] = 0;
                }
            }
            return values;
        }

        #endregion 粘稠属性

        //ADDITIONAL_PUMPING
        public double[] GetADDITIONAL_PUMPING(int dmLoopIndex)
        {
            //UsedDrug.flush_Groups[oneRow.UsedDrug.FlushGroupIndex].flush_Params[dmLoopIndex].InjectorRinseVolume
            double[] values = new double[MaxColPointCount];
            for (int col = 0; col < StationColNum; col++)
            {
                int FlushGroupIndex = RowStations[col].UsedDrug.FlushGroupIndex;
                double value = RowStations[col].UsedDrug.flush_Groups[FlushGroupIndex].flush_Params[dmLoopIndex].ADDITIONAL_PUMPING;
                if ((RowStations[col].UsedFlag == 0) || (RowStations[col].FeiZhengZhiMode == 1))
                {
                    //非整只不支持多抽
                    value = 0;
                }

                values[col] = value;
            }
            return values;
        }

        //DrugCountOfLoopFlush
        public int[] GetDrugCountOfLoopFlush(int dmLoopIndex)
        {
            int[] values = new int[MaxColPointCount];

            for (int col = 0; col < StationColNum; col++)
            {
                int FlushGroupIndex = RowStations[col].UsedDrug.FlushGroupIndex;
                int flushLoopCount = RowStations[col].UsedDrug.flush_Groups[FlushGroupIndex].FlushLoopCount + 1;
                int value = -1;
                if ((RowStations[col].UsedFlag == 1) && (dmLoopIndex < flushLoopCount))
                {
                    value = RowStations[col].UsedDrug.flush_Groups[FlushGroupIndex].flush_Params[dmLoopIndex].DrugCountOfLoopFlush;
                }
                else
                {
                    value = -1;//如果只循环一次，第二次循环中配药的个数设置为0
                }
                values[col] = value;
            }
            return values;
        }

        //LastBottleAdditionOutVolume
        public double[] GetLastBottleAdditionOutVolume(int dmLoopIndex)
        {
            //UsedDrug.flush_Groups[oneRow.UsedDrug.FlushGroupIndex].flush_Params[dmLoopIndex].InjectorRinseVolume
            double[] values = new double[MaxColPointCount];
            for (int col = 0; col < StationColNum; col++)
            {
                int FlushGroupIndex = RowStations[col].UsedDrug.FlushGroupIndex;
                double value = RowStations[col].UsedDrug.flush_Groups[FlushGroupIndex].flush_Params[dmLoopIndex].LastBottleAdditionOutVolume;
                if ((RowStations[col].UsedFlag == 0) || (RowStations[col].FeiZhengZhiMode == 1))
                {
                    //非整只不支持最后一瓶多抽
                    value = 0;
                }
                values[col] = value;
            }
            return values;
        }

        //AdditionalOutAirVolume
        public double[] GetAdditionalOutAirVolume(int dmLoopIndex)
        {
            double[] values = new double[MaxColPointCount];
            for (int col = 0; col < StationColNum; col++)
            {
                if ((RowStations[col].UsedFlag == 1) && (RowStations[col].FeiZhengZhiMode == 0))
                {
                    //非整只不支持多抽空气
                    int FlushGroupIndex = RowStations[col].UsedDrug.FlushGroupIndex;
                    values[col] = RowStations[col].UsedDrug.flush_Groups[FlushGroupIndex].flush_Params[dmLoopIndex].AdditionalOutAirVolume;
                }
                else
                {
                    values[col] = 0;
                }
            }
            return values;
        }

        //FlushInAirSpeed
        public int[] GetFlushInAirSpeed(int dmLoopIndex)
        {
            int[] values = new int[MaxColPointCount];
            for (int col = 0; col < StationColNum; col++)
            {
                int FlushGroupIndex = RowStations[col].UsedDrug.FlushGroupIndex;
                int percent = RowStations[col].UsedDrug.flush_Groups[FlushGroupIndex].flush_Params[dmLoopIndex].FlushInAirSpeed;

                values[col] = percent;
            }
            return values;
        }

        //FLUSH_AIRE
        public double[] GetFLUSH_AIRE(int dmLoopIndex)
        {
            //UsedDrug.flush_Groups[oneRow.UsedDrug.FlushGroupIndex].flush_Params[dmLoopIndex].InjectorRinseVolume
            double[] values = new double[MaxColPointCount];
            for (int col = 0; col < StationColNum; col++)
            {
                int FlushGroupIndex = RowStations[col].UsedDrug.FlushGroupIndex;
                double value = RowStations[col].UsedDrug.flush_Groups[FlushGroupIndex].flush_Params[dmLoopIndex].FLUSH_AIRE;
                if ((RowStations[col].UsedFlag == 0) || (RowStations[col].FeiZhengZhiMode == 1))
                {
                    value = 0;
                }
                values[col] = value;
            }
            return values;
        }

        //OutLowOffset
        public double[] GetFlushOutLowOffset(int dmLoopIndex)
        {
            //UsedDrug.flush_Groups[oneRow.UsedDrug.FlushGroupIndex].flush_Params[dmLoopIndex].InjectorRinseVolume
            double[] values = new double[MaxColPointCount];
            for (int col = 0; col < StationColNum; col++)
            {
                int FlushGroupIndex = RowStations[col].UsedDrug.FlushGroupIndex;
                double value = RowStations[col].UsedDrug.flush_Groups[FlushGroupIndex].flush_Params[dmLoopIndex].OutLowOffset;
                if (RowStations[col].UsedFlag == 0)
                {
                    value = 0;
                }
                values[col] = value;
            }
            return values;
        }

        #endregion flush param

        #region 反复抽液

        //RePullOutVolume
        public double[] GetFlushRePullOutVolume(int dmLoopIndex)
        {
            //UsedDrug.flush_Groups[oneRow.UsedDrug.FlushGroupIndex].flush_Params[dmLoopIndex].InjectorRinseVolume
            double[] values = new double[MaxColPointCount];
            for (int col = 0; col < StationColNum; col++)
            {
                int FlushGroupIndex = RowStations[col].UsedDrug.FlushGroupIndex;
                double value = RowStations[col].UsedDrug.flush_Groups[FlushGroupIndex].flush_Params[dmLoopIndex].RePullOutVolume;
                if ((RowStations[col].UsedFlag == 0) || (RowStations[col].FeiZhengZhiMode == 1))
                {
                    value = 0;
                }
                values[col] = value;
            }
            return values;
        }

        //RePullCount
        public int[] GetFlushRePullCount(int dmLoopIndex)
        {
            int[] values = new int[MaxColPointCount];
            for (int col = 0; col < StationColNum; col++)
            {
                int FlushGroupIndex = RowStations[col].UsedDrug.FlushGroupIndex;
                int value = RowStations[col].UsedDrug.flush_Groups[FlushGroupIndex].flush_Params[dmLoopIndex].RePullCount;
                if (RowStations[col].UsedFlag == 0)
                {
                    value = 0;
                }
                values[col] = value;
            }
            return values;
        }

        //RePullOutSpeed
        public int[] GetFlushRePullOutSpeed(int dmLoopIndex)
        {
            int[] values = new int[MaxColPointCount];
            for (int col = 0; col < StationColNum; col++)
            {
                int FlushGroupIndex = RowStations[col].UsedDrug.FlushGroupIndex;
                int percent = RowStations[col].UsedDrug.flush_Groups[FlushGroupIndex].flush_Params[dmLoopIndex].RePullOutSpeed;

                values[col] = percent;
            }
            return values;
        }

        //RePullInSpeed
        public int[] GetFlushRePullInSpeed(int dmLoopIndex)
        {
            int[] values = new int[MaxColPointCount];
            for (int col = 0; col < StationColNum; col++)
            {
                int FlushGroupIndex = RowStations[col].UsedDrug.FlushGroupIndex;
                int percent = RowStations[col].UsedDrug.flush_Groups[FlushGroupIndex].flush_Params[dmLoopIndex].RePullInSpeed;

                values[col] = percent;
            }
            return values;
        }

        //RePullPumping_Wait
        public double[] GetFlushRePullPumping_Wait(int dmLoopIndex)
        {
            //UsedDrug.flush_Groups[oneRow.UsedDrug.FlushGroupIndex].flush_Params[dmLoopIndex].InjectorRinseVolume
            double[] values = new double[MaxColPointCount];
            for (int col = 0; col < StationColNum; col++)
            {
                int FlushGroupIndex = RowStations[col].UsedDrug.FlushGroupIndex;
                double value = RowStations[col].UsedDrug.flush_Groups[FlushGroupIndex].flush_Params[dmLoopIndex].RePullPumping_Wait;
                if (RowStations[col].UsedFlag == 0)
                {
                    value = 0;
                }
                values[col] = value;
            }
            return values;
        }

        #endregion 反复抽液

        #region 二次回抽

        //PumpbackVolume
        public double[] GetPumpbackVolume(int pumpbackLoopIndex)
        {
            //UsedDrug.flush_Groups[oneRow.UsedDrug.FlushGroupIndex].flush_Params[dmLoopIndex].InjectorRinseVolume
            double[] values = new double[MaxColPointCount];
            for (int col = 0; col < StationColNum; col++)
            {
                int FlushGroupIndex = RowStations[col].UsedDrug.FlushGroupIndex;
                double value = RowStations[col].UsedDrug.flush_Groups[FlushGroupIndex].pumpBack_Params[pumpbackLoopIndex].PumpbackVolume;
                if (RowStations[col].UsedFlag == 1)
                {
                    if (value > DeviceConfig.InjectorMaxML)
                    {
                        value = (float)DeviceConfig.InjectorMaxML;
                    }
                    values[col] = value;
                }
                else
                {
                    values[col] = 0;
                }
            }
            return values;
        }

        //PumpBackInAire
        public double[] GetPumpBackInAire(int pumpbackLoopIndex)
        {
            //UsedDrug.flush_Groups[oneRow.UsedDrug.FlushGroupIndex].flush_Params[dmLoopIndex].InjectorRinseVolume
            double[] values = new double[MaxColPointCount];
            for (int col = 0; col < StationColNum; col++)
            {
                int FlushGroupIndex = RowStations[col].UsedDrug.FlushGroupIndex;
                double value = RowStations[col].UsedDrug.flush_Groups[FlushGroupIndex].pumpBack_Params[pumpbackLoopIndex].PumpBackInAire;
                if ((RowStations[col].UsedFlag == 1))
                {
                    values[col] = value;
                }
                else
                {
                    values[col] = 0;
                }
            }
            return values;
        }

        //PumpBackInAireSpeed
        public int[] GetPumpBackInAireSpeed(int pumpbackLoopIndex)
        {
            int[] values = new int[MaxColPointCount];
            for (int col = 0; col < StationColNum; col++)
            {
                int FlushGroupIndex = RowStations[col].UsedDrug.FlushGroupIndex;
                int percent = RowStations[col].UsedDrug.flush_Groups[FlushGroupIndex].pumpBack_Params[pumpbackLoopIndex].PumpBackInAireSpeed;

                values[col] = percent;
            }
            return values;
        }

        //PumpBackLoopCount
        public int[] GetPumpBackLoopCount()
        {
            int[] values = new int[MaxColPointCount];
            for (int col = 0; col < StationColNum; col++)
            {
                int FlushGroupIndex = RowStations[col].UsedDrug.FlushGroupIndex;
                int value = RowStations[col].UsedDrug.flush_Groups[FlushGroupIndex].PumpBackLoopCount;
                if (RowStations[col].UsedFlag == 1)
                {
                    values[col] = value;
                }
                else
                {
                    values[col] = 0;
                }
            }
            return values;
        }

        //PumpBackWait
        public double[] GetPumpBackWait(int pumpbackLoopIndex)
        {
            //UsedDrug.flush_Groups[oneRow.UsedDrug.FlushGroupIndex].flush_Params[dmLoopIndex].InjectorRinseVolume
            double[] values = new double[MaxColPointCount];
            for (int col = 0; col < StationColNum; col++)
            {
                int FlushGroupIndex = RowStations[col].UsedDrug.FlushGroupIndex;
                double value = RowStations[col].UsedDrug.flush_Groups[FlushGroupIndex].pumpBack_Params[pumpbackLoopIndex].PumpBackWait;
                if (RowStations[col].UsedFlag == 1)
                {
                    values[col] = value;
                }
                else
                {
                    values[col] = 0;
                }
            }
            return values;
        }

        public int GetMaxPumpBackWait(int pumpbackLoopIndex)
        {
            double[] pumpbackWait = GetPumpBackWait(pumpbackLoopIndex);
            double maxPumpBackWait = GetMaxValue(pumpbackWait);
            int waitTime = (int)(maxPumpBackWait * 1000);
            return waitTime;
        }

        #region 回抽的反复多抽

        //PumpBackEnableRepull
        public int[] GetPumpBackEnableRepull(int pumpbackLoopIndex)
        {
            int[] values = new int[MaxColPointCount];
            for (int col = 0; col < StationColNum; col++)
            {
                int FlushGroupIndex = RowStations[col].UsedDrug.FlushGroupIndex;
                int value = 0;
                if (RowStations[col].UsedFlag == 1)
                {
                    value = RowStations[col].UsedDrug.flush_Groups[FlushGroupIndex].pumpBack_Params[pumpbackLoopIndex].PumpBackEnableRepull;
                }
                else
                {
                    value = 0;
                }
                values[col] = value;
            }
            return values;
        }

        //PumpBackRePullCount
        public int[] GetPumpBackRePullCount(int pumpbackLoopIndex)
        {
            int[] PumpBackEnableRepulls = GetPumpBackEnableRepull(pumpbackLoopIndex);
            int[] values = new int[MaxColPointCount];
            for (int col = 0; col < StationColNum; col++)
            {
                int FlushGroupIndex = RowStations[col].UsedDrug.FlushGroupIndex;
                int value = 0;
                if ((PumpBackEnableRepulls[col] == 1) && (RowStations[col].UsedFlag == 1))
                {
                    value = RowStations[col].UsedDrug.flush_Groups[FlushGroupIndex].pumpBack_Params[pumpbackLoopIndex].PumpBackRePullCount;
                }
                else
                {
                    value = 0;
                }

                values[col] = value;
            }
            return values;
        }

        //PumpBackRePullVolume
        public double[] GetPumpBackRePullVolume(int pumpbackLoopIndex)
        {
            //UsedDrug.flush_Groups[oneRow.UsedDrug.FlushGroupIndex].flush_Params[dmLoopIndex].InjectorRinseVolume
            double[] values = new double[MaxColPointCount];
            for (int col = 0; col < StationColNum; col++)
            {
                int FlushGroupIndex = RowStations[col].UsedDrug.FlushGroupIndex;
                double value = RowStations[col].UsedDrug.flush_Groups[FlushGroupIndex].pumpBack_Params[pumpbackLoopIndex].PumpBackRePullVolume;
                if (RowStations[col].UsedFlag == 0)
                {
                    value = 0;
                }
                values[col] = value;
            }
            return values;
        }

        //PumpBackRePullOutSpeed
        public int[] GetPumpBackRePullOutSpeed(int pumpbackLoopIndex)
        {
            int[] values = new int[MaxColPointCount];
            for (int col = 0; col < StationColNum; col++)
            {
                int FlushGroupIndex = RowStations[col].UsedDrug.FlushGroupIndex;
                int percent = RowStations[col].UsedDrug.flush_Groups[FlushGroupIndex].pumpBack_Params[pumpbackLoopIndex].PumpBackRePullOutSpeed;

                values[col] = percent;
            }
            return values;
        }

        //PumpBackRePullInSpeed
        public int[] GetPumpBackRePullInSpeed(int pumpbackLoopIndex)
        {
            int[] values = new int[MaxColPointCount];
            for (int col = 0; col < StationColNum; col++)
            {
                int FlushGroupIndex = RowStations[col].UsedDrug.FlushGroupIndex;
                int percent = RowStations[col].UsedDrug.flush_Groups[FlushGroupIndex].pumpBack_Params[pumpbackLoopIndex].PumpBackRePullInSpeed;

                values[col] = percent;
            }
            return values;
        }

        //PumpBacRePullkWait
        public double[] GetPumpBackRePullkWait(int pumpbackLoopIndex)
        {
            //UsedDrug.flush_Groups[oneRow.UsedDrug.FlushGroupIndex].flush_Params[dmLoopIndex].InjectorRinseVolume
            double[] values = new double[MaxColPointCount];
            for (int col = 0; col < StationColNum; col++)
            {
                int FlushGroupIndex = RowStations[col].UsedDrug.FlushGroupIndex;
                double value = RowStations[col].UsedDrug.flush_Groups[FlushGroupIndex].pumpBack_Params[pumpbackLoopIndex].PumpBacRePullkWait;
                if (RowStations[col].UsedFlag == 0)
                {
                    value = 0;
                }
                values[col] = value;
            }
            return values;
        }

        #endregion 回抽的反复多抽

        #endregion 二次回抽
    }
}